unit uniAmmo;

interface

uses
  Classes;

type
  { ActiveAmmo }

  ActiveAmmo = class(TObject)
  public

    pos: array[0..2] of Single;
    vel: array[0..2] of Single;
    damage: Single;
    back: ActiveAmmo;
    next: ActiveAmmo;
    constructor Create;
    destructor Destroy; override;

    procedure init(p, v: array of Single; d: Single);
    procedure updatePos;
  end;

var
  ammoCount: Integer = 0;

implementation

{ ActiveAmmo }

constructor ActiveAmmo.Create;
begin
  back := nil;
  next := nil;
  Inc(ammoCount);
end;

destructor ActiveAmmo.Destroy;
begin
  Dec(ammoCount);
  inherited;
end;

procedure ActiveAmmo.init(p, v: array of Single; d: Single);
begin
  pos[0] := p[0];
  pos[1] := p[1];
  pos[2] := p[2];
  vel[0] := v[0];
  vel[1] := v[1];
  vel[2] := v[2];
  damage := d;
  back := nil;
  next := nil;
end;

procedure ActiveAmmo.updatePos;
begin
  pos[0] := pos[0] + vel[0];
  pos[1] := pos[1] + vel[1];
  pos[2] := pos[2] + vel[2];
end;

end.

